package com.he.hsdyc.designmodule.single;

/**
 * 功能描述: 单例模式测试类
 * @date: 2019/8/6
 */
public class OrderTest {

    public static void main(String[] args) {

        ThreadOrder[] ThreadArr = new ThreadOrder[10];
        for (int i = 0; i < ThreadArr.length; i++) {
            ThreadArr[i] = new ThreadOrder();
            ThreadArr[i].start();
        }
    }

}

// 测试线程--十个线程测试，通过对象的hashcode是否相同判断是单例还是多例
class ThreadOrder extends Thread {
    @Override
    public void run() {
        System.out.println(OrderStatic.getInstance().hashCode());
    }
}
